package com.heima.user.controller;

import com.heima.model.user.dtos.LoginDto;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.user.service.IUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1")
@RequiredArgsConstructor
@Api(value = "app端用户登录-控制器")
public class UserController {
    private final IUserService userService;

    /**
     * 密码登录
     *
     * @param loginDto
     * @return
     */
   /* @PostMapping("/login/login_auth")
    @ApiOperation("用户登录")
    public ResponseResult login(@RequestBody LoginDto loginDto) {
        return  userService.login(loginDto);
    }*/


    @PostMapping("/login/login_auth")
    @ApiOperation("基于redis+token登录")
    public ResponseResult loginByRedisWithToken(@RequestBody LoginDto loginDto) {
        return userService.loginByRedisWithToken(loginDto);
    }
}
